//
//  MainTableVC.swift
//  DayStudy
//
//  Created by Wheatping on 16/3/4.
//  Copyright © 2016年 Wheatping. All rights reserved.
//

import UIKit

class MainTableVC: UITableViewController {

    let keyAndNameDic=["BannerVC":"2016-03-07"]
    
    
    
    private var keys=[String]()
    private var values=[String]()
    
    override func viewDidLoad() {
        super.viewDidLoad()

        title="Day"
        
        //构建key value数组
        for key in keyAndNameDic.keys
        {
            keys.append(key)
        }
        
        
        for value in keyAndNameDic.values
        {
            values.append(value)
        }
        
        //self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "mainTableViewCell")
        self.tableView.tableFooterView=UIView()
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    // MARK: - Table view data source

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 1
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return keyAndNameDic.count
    }


    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        
        let cell = tableView.dequeueReusableCellWithIdentifier("mainTableViewCell", forIndexPath: indexPath)
        
        
        cell.textLabel?.text=keys[indexPath.row]
        cell.detailTextLabel?.text=values[indexPath.row]
        
        return cell
    }
    
    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        
        let bannerVC=BannerVC()
        
        self.navigationController?.pushViewController(bannerVC, animated: true)
    }

    
}